﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NeuralNetworks.ActivationFunctions
{
    class LinearFunction : IActivationFunction
    {
        private double a;
        private double b;

        public double A {
            get{return this.a;} 
            set{this.a = value;}
        }
        public double B {
            get{return this.b;}
            set{this.b = value;}
        }

        public LinearFunction() { this.a = 1.0; this.b = 0.0;}
        public LinearFunction(double a, double b) { this.a = a; this.b = b; }

        public double Compute(double x)
        {
            return a * x + b;
        }
        public double ComputeDifferential(double x)
        {
            return a;
        }

        public override string ToString()
        {
            return ActivationFunctionFactory.linear;
        }

    }
}
